/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JanelaCOnfiguracaoGeral.java
 *
 * Created on 28/06/2011, 00:09:24
 */

package client;

import client.entidades.ConfigUsuario;
import client.entidades.ConfigConexao;

/**
 *
 * @author Anderson
 */
public class JanelaConfiguracaoGeral extends javax.swing.JFrame {

    /** Creates new form JanelaCOnfiguracaoGeral */
    public JanelaConfiguracaoGeral() {
        initComponents();
        tfNickname.setText(ConfigUsuario.getInstance().getNickName());
        tfAlternativo.setText(ConfigUsuario.getInstance().getNickNameAlternativo());
        tfNome.setText(ConfigUsuario.getInstance().getNome());
        tfEmail.setText(ConfigUsuario.getInstance().getEmail());
        tfUserid.setText(ConfigUsuario.getInstance().getUserId());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        painelGeral = new javax.swing.JPanel();
        imgConfig = new javax.swing.JLabel();
        labelNickname = new javax.swing.JLabel();
        tfNickname = new javax.swing.JTextField();
        labelAlternativo = new javax.swing.JLabel();
        tfAlternativo = new javax.swing.JTextField();
        labelNome = new javax.swing.JLabel();
        tfNome = new javax.swing.JTextField();
        labelEmail = new javax.swing.JLabel();
        tfEmail = new javax.swing.JTextField();
        labelUserid = new javax.swing.JLabel();
        tfUserid = new javax.swing.JTextField();
        btAplicar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Configuração - geral");

        painelGeral.setBackground(new java.awt.Color(255, 255, 255));

        imgConfig.setIcon(new javax.swing.ImageIcon(getClass().getResource("/client/Settings1.png"))); // NOI18N

        labelNickname.setText("Nickname");

        labelAlternativo.setText("Nickname alternativo");

        labelNome.setText("Nome");

        labelEmail.setText("Email");

        labelUserid.setText("User ID");

        btAplicar.setText("Aplicar");
        btAplicar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAplicarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout painelGeralLayout = new javax.swing.GroupLayout(painelGeral);
        painelGeral.setLayout(painelGeralLayout);
        painelGeralLayout.setHorizontalGroup(
            painelGeralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelGeralLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelGeralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelEmail)
                    .addComponent(labelUserid)
                    .addGroup(painelGeralLayout.createSequentialGroup()
                        .addGroup(painelGeralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(tfUserid, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfEmail, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelNickname, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfNickname, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE)
                            .addComponent(labelAlternativo, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfAlternativo, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelNome, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tfNome, javax.swing.GroupLayout.Alignment.LEADING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 78, Short.MAX_VALUE)
                        .addGroup(painelGeralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(imgConfig)
                            .addComponent(btAplicar))))
                .addContainerGap())
        );
        painelGeralLayout.setVerticalGroup(
            painelGeralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelGeralLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelGeralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(painelGeralLayout.createSequentialGroup()
                        .addComponent(labelNickname)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tfNickname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(labelAlternativo)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tfAlternativo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(labelNome)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tfNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(labelEmail)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tfEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(labelUserid)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(painelGeralLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(tfUserid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btAplicar)))
                    .addComponent(imgConfig))
                .addContainerGap(19, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(painelGeral, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(painelGeral, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btAplicarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAplicarActionPerformed
        ConfigUsuario.getInstance().setNickName(tfNickname.getText());
        ConfigUsuario.getInstance().setNickNameAlternativo(tfAlternativo.getText());
        ConfigUsuario.getInstance().setNome(tfNome.getText());
        ConfigUsuario.getInstance().setEmail(tfEmail.getText());
        ConfigUsuario.getInstance().setUserId(tfUserid.getText());
        this.dispose();
    }//GEN-LAST:event_btAplicarActionPerformed

    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btAplicar;
    private javax.swing.JLabel imgConfig;
    private javax.swing.JLabel labelAlternativo;
    private javax.swing.JLabel labelEmail;
    private javax.swing.JLabel labelNickname;
    private javax.swing.JLabel labelNome;
    private javax.swing.JLabel labelUserid;
    private javax.swing.JPanel painelGeral;
    private javax.swing.JTextField tfAlternativo;
    private javax.swing.JTextField tfEmail;
    private javax.swing.JTextField tfNickname;
    private javax.swing.JTextField tfNome;
    private javax.swing.JTextField tfUserid;
    // End of variables declaration//GEN-END:variables

}
